import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';

// 视频子集
@Entity()
export class VideoItem {
  @PrimaryGeneratedColumn()
  id: number;

  // 视频id
  @Column({ type: 'varchar', name: 'videoId', default: '0' })
  videoId: string;

  // 视频播放链接
  @Column({ type: 'varchar', name: 'videoUrl', default: '' })
  videoUrl: string;

  // 视频的集数
  @Column({ type: 'int', name: 'videoNumber', default: '0' })
  videoNumber: number;

  @Column()
  create_time: Date;

  @Column()
  updated_time: Date;
}

// 视频子集-用户 用于保存用户播放记录
@Entity()
export class VideoItemUser {
  @PrimaryGeneratedColumn()
  id: number;

  // 视频itemId
  @Column({ type: 'varchar', name: 'videoId', default: '' })
  videoId: string;

  // 视频itemId
  @Column({ type: 'varchar', name: 'videoItemId', default: '' })
  videoItemId: string;

  // 用户id
  @Column({ type: 'varchar', name: 'userId', default: '' })
  userId: string;

  // 历史记录
  @Column({ type: 'varchar', name: 'historyRecord', default: '' })
  historyRecord: string;

  @Column()
  create_time: Date;

  @Column()
  updated_time: Date;
}
